package health.lm.com.shop.presenter;

import java.util.ArrayList;
import java.util.List;

import health.lm.com.component_base.base.mvp.contract.XPresent;
import health.lm.com.network.callback.SimpleCallBack;
import health.lm.com.shop.activity.HLMyCompanyActivity;
import health.lm.com.shop.entity.HLMyCompanyEntity;
import health.lm.com.shop.entity.HLPeopleEntity;
import health.lm.com.shop.entity.MyCompanyResponse;
import health.lm.com.shop.model.MallModel;

/**
 * Created by Android Studio .
 * Project：hlian health.lm.com.shop.presenter
 * Date：2019/8/12 17:05
 * Introduce：我的商会
 */
public class HLMyCompanyPresenter extends XPresent<HLMyCompanyActivity> {
    public void getData(String id) {
        MallModel.getInstance().myBusinessData(id, new SimpleCallBack<MyCompanyResponse>() {
            @Override
            public void onSuccess(MyCompanyResponse pResponse) {
                if (hasV()) getV().setNewData(pResponse.getInfo());
            }
        });
        //if (hasV()) getV().setNewData(getResource());
    }

    private HLMyCompanyEntity getResource() {//资源
        HLMyCompanyEntity companyEntity = new HLMyCompanyEntity();
        companyEntity.setCompany_img("http://image109.360doc.com/DownloadImg/2018/03/1008/126782666_1_2018031008485635.jpeg");
        companyEntity.setCompany_name("会链研究院");
        companyEntity.setMember_num("1234");
        companyEntity.setMember_add_num("255");
        companyEntity.setMember_followed("5w");

        List<HLMyCompanyEntity.LeaderEntity> entityList = new ArrayList<>();
        for (int a = 0; a < 8; a++) {
            HLMyCompanyEntity.LeaderEntity leaderEntity = new HLMyCompanyEntity.LeaderEntity();
            leaderEntity.setAvatar("http://image109.360doc.com/DownloadImg/2018/03/1008/126782666_1_2018031008485635.jpeg");
            leaderEntity.setId(a + "");
            leaderEntity.setName("这是名称" + a);
            leaderEntity.setPosition("董事/乖");
            leaderEntity.setTag("会长/真长");
            entityList.add(leaderEntity);
        }
        companyEntity.setEntityList(entityList);

        List<HLPeopleEntity> entities = new ArrayList<>();
        for (int a = 0; a < 10; a++) {
            HLPeopleEntity peopleEntity = new HLPeopleEntity();
            peopleEntity.setAvatar("http://image109.360doc.com/DownloadImg/2018/03/1008/126782666_1_2018031008485635.jpeg");
            peopleEntity.setName("测试名称" + a);
            peopleEntity.setId(a);
            peopleEntity.setPhone("13112345678");
            peopleEntity.setTime("2018-08-09");
            peopleEntity.setDepartment("联络部");
            entities.add(peopleEntity);
        }
        companyEntity.setPeopleEntities(entities);
        return companyEntity;
    }
}
